package data.dao;

import security.access.AccessChecker;
import security.crypto.Cipher;
import data.io.FileIO;
import data.model.Data;

public class SecuredDAO extends DAO {
	private final Cipher cipher;
	
	public SecuredDAO(AccessChecker accessChecker, Cipher cipher) {
		super(accessChecker);
		this.cipher = cipher;
	}
	
	@Override
	protected Data readData(String path) {
		Data toEncrypt = new Data(FileIO.read(path));
		return cipher.encrypt(toEncrypt);
	}
	
}
